﻿#ifndef HTTPFORM_H
#define HTTPFORM_H

#include <QWidget>
#include <QFileDialog>
#include <QHttpMultiPart>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QEventLoop>
#include <QUrlQuery>
#include <QAction>

namespace Ui {
class HttpForm;
}

class HttpForm : public QWidget
{
    Q_OBJECT

public:
    explicit HttpForm(QWidget *parent = nullptr);
    ~HttpForm();

public: signals:
    void statusBarShow(QString msg);

private:
    Ui::HttpForm *ui;
    QNetworkAccessManager *m_pNetworkAccessManager;
    QNetworkReply *m_pNetworkReply;
    QNetworkAccessManager *m_pDownloadNetworkAccessManager;
    QAction *m_pSelectPathAction;


private slots:
    void on_currentTextChanged(const QString &text);
    void on_selectFile();
    void on_send();
    void on_replyFinished(QNetworkReply *reply);
    void on_download();
    void on_selectPath();

private:
    void httpGet();
    void httpPost();
};

#endif // HTTPFORM_H
